home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / CON-03A.ZIP / CONFIGUR.PAS < prev    next >
Pascal/Delphi Source File  |  1995-10-25  |  6KB  |  239 lines

  1. (* Conspiracy BBS Software Version 0.01α (c)1995 Grooven Designs  *)
  2. (* Conspiracy Configuration Program                               *)
  3. (* Coded by Paul Maggs / Grooven Designs                          *)
  4.  
  5. (* Conspiracy v0.01α Configuration Unit (will be) *)
  6. unit configur;
  7.  
  8. interface
  9.  
  10. procedure init_config_file;
  11. procedure init_ansi_file;
  12. procedure set_options;
  13. procedure insert_config;
  14. procedure menu;
  15. procedure run_config;
  16.  
  17. implementation
  18.  
  19. uses crt,
  20.      ansi;
  21.  
  22. {$R+}
  23.  
  24. type
  25.       GroovyConfig = Record
  26.         BoardName       :   String[30];
  27.         SysopName       :   String[30];
  28.         BbsPhone        :   String[15];
  29.         Rego            :   String[12];
  30.         BbsDir          :   String[30];
  31.         DataDir         :   String[30];
  32.         TxtDir          :   String[30];
  33. {       MsgDir          :   String[30];}
  34. end;
  35.  
  36.  
  37. var
  38.   configfile       : file of GroovyConfig;
  39.   config           : GroovyConfig;
  40.   i                : byte;
  41.   options          : array[1..9] of string[30];
  42.   choice           : char;
  43.   option           : byte;
  44.   grid_ref         : byte;
  45.   cows_come_home   : boolean;
  46.  
  47.  
  48. procedure init_config_file;
  49. begin
  50.   assign(configfile,'data\config.dat');
  51.   reset(configfile);
  52. end;
  53.  
  54.  
  55. procedure init_ansi_file;
  56. begin
  57.   clrscr;
  58.   write_picture('configa');
  59. end;
  60.  
  61. procedure set_options;
  62. begin
  63.   options[1]:=' Bulletin Board Name ';
  64.   options[2]:=' System Operator     ';
  65.   options[3]:=' BBS Phone Number    ';
  66.   options[4]:=' Registration Code   ';
  67.   options[5]:=' Main Directory      ';
  68.   options[6]:=' Data Directory      ';
  69.   options[7]:=' Text File Directory ';
  70. {  options[8]:=' Message Directory   ';}
  71. {  for i := 1 to 8 do
  72.   writeln(options[i]);}
  73. end;
  74.  
  75. procedure exit;
  76. begin
  77.   textcolor(3);
  78.   textbackground(0);
  79.   filemode:=2;
  80.   rewrite(Configfile);
  81.   write(configfile,config);
  82.   close(configfile);
  83.   clrscr;
  84.   writeln('      Conspiracy Configuration Program v0.01α (c) 1995 Grooven Designs');
  85.   halt
  86. end;
  87.  
  88.  
  89. procedure insert_config;
  90. begin
  91.   read(configfile,config);
  92.   textcolor(3);
  93.   gotoxy(32,9);
  94.   write(config.boardname);
  95.   gotoxy(32,10);
  96.   write(config.sysopname);
  97.   gotoxy(32,11);
  98.   write(config.bbsphone);
  99.   gotoxy(32,12);
  100.   write(config.rego);
  101.   gotoxy(32,13);
  102.   write(config.bbsdir);
  103.   gotoxy(32,14);
  104.   write(config.datadir);
  105.   gotoxy(32,15);
  106.   write(config.txtdir);
  107. end;
  108.  
  109. procedure menu;
  110. begin
  111.   gotoxy(9,9);
  112.   textcolor(0);
  113.   textbackground(3);
  114.   write(options[1]);
  115.   option:=1;
  116.   grid_ref:=9;
  117.   repeat;
  118.   choice:=readkey;
  119.   case choice of
  120.     #13       : if option=1 then begin
  121.                   textcolor(3);
  122.                   textbackground(0);
  123.                   gotoxy(32,9);
  124.                   Readln(config.boardname);
  125.                  end else
  126.                 if option=2 then begin
  127.                   textcolor(3);
  128.                   textbackground(0);
  129.                   gotoxy(32,10);
  130.                   Readln(config.sysopname);
  131.                 end else
  132.                 if option=3 then begin
  133.                   textcolor(3);
  134.                   textbackground(0);
  135.                   gotoxy(32,11);
  136.                   readln(config.bbsphone);
  137.                 end else
  138.                 if option=4 then begin
  139.                   textcolor(3);
  140.                   textbackground(0);
  141.                   gotoxy(32,12);
  142.                   readln(config.rego);
  143.                 end else
  144.                 if option=5 then begin
  145.                   textcolor(3);
  146.                   textbackground(0);
  147.                   gotoxy(32,13);
  148.                   readln(config.bbsdir);
  149.                 end else
  150.                 if option=6 then begin
  151.                   textcolor(3);
  152.                   textbackground(0);
  153.                   gotoxy(32,14);
  154.                   readln(config.datadir);
  155.                 end else
  156.                 if option=7 then begin
  157.                   textcolor(3);
  158.                   textbackground(0);
  159.                   gotoxy(32,15);
  160.                   readln(config.txtdir);
  161.               end;
  162.  
  163.  
  164.     #27       : exit;
  165.     #80       : begin
  166.                   if option<7 then begin    {To enable it to loop}
  167.                     gotoxy(9,grid_ref);
  168.                     textbackground(0);
  169.                     textcolor(7);
  170.                     write(options[option]);
  171.                     inc(grid_ref);
  172.                     gotoxy(9,grid_ref);
  173.                     textbackground(3);
  174.                     textcolor(0);
  175.                     {i:=i-1;}
  176.                     writeln(options[option+1]);
  177.                     option:=option+1;
  178.                   end else begin
  179.                     gotoxy(9,grid_ref);
  180.                     textcolor(7);
  181.                     textbackground(0);
  182.                     write(options[7]);      {set to last option at the mo}
  183.                     grid_ref:=grid_ref-6;
  184.                     gotoxy(9,grid_ref);
  185.                     textcolor(0);
  186.                     textbackground(3);
  187.                     write(options[1]);
  188.                     option:=option-6;
  189.                   end
  190.                 end;
  191.  
  192.     #72       : begin
  193.                   if option>1 then begin
  194.                     gotoxy(9,grid_ref);
  195.                     textbackground(0);
  196.                     textcolor(7);
  197.                     write(options[option]);
  198.                     inc(grid_ref);
  199.                     gotoxy(9,grid_ref-2);
  200.                     textbackground(3);
  201.                     textcolor(0);
  202.                     {i:=i;}
  203.                     writeln(options[option-1]);
  204.                     option:=option-1;
  205.                     grid_ref:=grid_ref-2;
  206.                   end else begin
  207.                     gotoxy(9,grid_ref);
  208.                     textcolor(7);
  209.                     textbackground(0);
  210.                     write(options[1]);      {set to first option at the mo}
  211.                     grid_ref:=grid_ref+6;
  212.                     gotoxy(9,grid_ref);
  213.                     textcolor(0);
  214.                     textbackground(3);
  215.                     write(options[7]);
  216.                     option:=option+6;
  217.                   end;
  218.  
  219.                 end;
  220.  
  221.  
  222. end;
  223. cows_come_home:=false;
  224. until cows_come_home;
  225.  
  226.  
  227. end;
  228.  
  229. (* ------------------------------------------------------------------------ *)
  230.  
  231. procedure run_config;
  232. begin
  233.   init_config_file;
  234.   init_ansi_file;
  235.   set_options;
  236.   insert_config;
  237.   menu;
  238. end;
  239. end.